// Copyright (C) 2020 Wuguyannian - All Rights Reserved

#include "TapDBEditor.h"
#include "Core.h"
#include "Modules/ModuleManager.h"
#include "ISettingsModule.h"
#include "TapDBRuntimeSettings.h"

#define LOCTEXT_NAMESPACE "FTapDBEditorModule"

void FTapDBEditorModule::StartupModule()
{
    // register settings
	ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings");

	if (SettingsModule != nullptr)	
	{
		SettingsModule->RegisterSettings("Project", "Plugins", "TapDB",
			LOCTEXT("TapDBSettingsName", "TapDB"),
			LOCTEXT("TapDBSettingsDescription", "Project settings for TapDB plugin"),
			GetMutableDefault<UTapDBRuntimeSettings>()
		);
	}
}

void FTapDBEditorModule::ShutdownModule()
{
    // unregister settings
	ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings");

	if (SettingsModule != nullptr)
	{
       	SettingsModule->UnregisterSettings("Project", "Plugins", "TapDB");
	}
}

#undef LOCTEXT_NAMESPACE
	
IMPLEMENT_MODULE(FTapDBEditorModule, TapDBEditor)
